package my.app.company;

import my.app.R;
import my.app.ServiceClient;
import android.app.AlertDialog;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Point;
import android.view.MotionEvent;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;

public class MyOverlay extends Overlay {
	
	Point screenPts = null;
	Bitmap bmp = null;
	GeoPoint pp = null;
	
	public MyOverlay(GeoPoint p) {
		pp = p;
	}
	
    public boolean draw(Canvas canvas, MapView mapView, boolean shadow, long when) {
        super.draw(canvas, mapView, shadow);                   
 
        //---translate the GeoPoint to screen pixels---
        screenPts = new Point();
        

        
		mapView.getProjection().toPixels(pp, screenPts);
 
        //---add the marker---
        bmp = BitmapFactory.decodeResource(
        mapView.getResources(), R.drawable.you);            
        canvas.drawBitmap(bmp, screenPts.x, screenPts.y-bmp.getHeight(), null);         
        return true;
    } 

    /*@Override
    public boolean onTap(GeoPoint p, MapView mapView) {
    	//Show a taxi information dialog. Which is the tapped..
    	Point pointTap = mapView.getProjection().toPixels(p, null);
		Point pointMap = mapView.getProjection().toPixels(pp, null);
		if(
			pointTap.x-pointMap.x>=0
			&& pointTap.x-pointMap.x<=bmp.getWidth()
			&& pointMap.y-pointTap.y>=0
			&& pointMap.y-pointTap.y<=bmp.getHeight()
		)
		{
			showInformation(mapView);
		}


    	
    	return super.onTap(p, mapView);
    }
    
    public void showInformation (MapView mapView) {
    	
    }*/
}
    /** Called when the activity is first created. */
